<?php
	require_once("../conexion/conexion.php");
	$cod = $_GET['area'];
	$resp = $_GET['resp'];
	$fecha = $_GET['fecha'];
	
	$fechaFin = explode("-",$fecha);
	$fechaFin = $fechaFin[2]."-".$fechaFin[1]."-".$fechaFin[0];
			
	$con = new Conexion();
    $con2 = $con->conexionBD("fpproduccion");
    $sql = "select ANombre from area where ACod='".$cod."'";
    $res = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
	$datos =   mysql_fetch_array($res);
	$con->cerrarBD();
	
	//lista de productos
	$con = new Conexion();
    $con2 = $con->conexionBD("fpproduccion");
    $sql = "select 
				BACantidad,
				ProNombre
				
				from bodarea ba
				inner join bodegacentral b on
				b.BodCCod=ba.BodCCod
				inner join producto p on
				p.ProCod=b.ProCod
		where ACod='".$cod."' and BAResponsable='".$resp."' and BAFecha='".$fechaFin."'";
    $res = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
	$con->cerrarBD();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Solicitud de Producto(s).</title>
<script>
function window.onbeforeprint()
{ 
	boton=document.getElementById("btn_Imprimir");
	boton.style.display = 'none'; 
} 
function window.onafterprint()
{ 
	boton=document.getElementById("btn_Imprimir");
	boton.style.display = 'block'; 
}
function Imprimir()
{
	window.print()
}
</script>
</head>

<body>
<form name="form" method="post" id="form">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td width="17%">&nbsp;</td>
	<td width="46%"><div align="right"><img src="../imagen/td_logo2.png" width="155" height="56" /></div></td>
	</tr>
<tr>
  <td colspan="2"><h3>Solicitud de Producto(s).</h3></td>
</tr>
<tr>
  <td colspan="2"><h5>Responsable: &nbsp;<label style='font-size:11px;'><?php echo $resp;?></label></h5></td>
  </tr>
<tr>
  <td colspan="2"><h5>Area Destino: &nbsp;<label style='font-size:11px;'><?php echo $datos[0];?></label></h5></td>
  </tr>
<tr>
  <td colspan="2"><h5>Fecha de Solicitud: &nbsp;<label style='font-size:11px;'><?php echo $fecha;?></label></h5></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>

<tr>
  <td colspan="2"><h3>Producto(s).</h3></td>
  </tr>

<tr>
  <td style="text-align:center"><h6>CANTIDAD</h6></td>
  <td style="text-align:center"><h6>PRODUCTO</h6></td>
  </tr>
<?php
	while($reg = mysql_fetch_array($res))
	{
		echo "<tr>";
		echo "<td width=\"17%\" style='text-align:center'><label style='font-size:15px;'>".$reg['BACantidad']."</label></td>";
		echo "<td width=\"46%\" style='text-align:center'><label style='font-size:11px;'>".$reg['ProNombre']."</label></td>";
		echo "<td width=\"37%\">&nbsp;</td>";
		echo "</tr>";
	}
?>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
  <td colspan="2">&nbsp;</td>
</tr>
<tr>
  <td colspan="2">&nbsp;</td>
</tr>
<tr>
  <td colspan="2"><div style="margin-left:40px">----------------------------------</div></td>
</tr>
<tr>
  <td colspan="2"><div style="margin-left:40px">Firma: &nbsp;<label style='font-size:11px;'><?php echo $resp;?></label></div></td>
</tr>
<tr>
  <td colspan="2" style="text-align:center; padding-top:8px;"><input name="btn_Imprimir" id="btn_Imprimir" type="button" onclick="Imprimir();" value="Imprimir" /></td>
</tr>
</table>
</form>
</body>
</html>
